import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Book from  '../views/Book.vue'
import BookManager from '../views/BookManager'
import AddBook from '../views/AddBook'
import Index from '../views/index'
import BookUpdate from '../views/BookUpdate'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/home',
  //   name: 'Home',
  //   component: Home
  // },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // },
  // {
  //   path: '/book',
  //   component:Book
  // },
  {
    path : '/',
    name:'图书管理',
    component: Index,
    show:true,
    redirect:'/BookManager', /*初始化没有被中时自动跳转到这*/
    children:[
      {
        path : '/BookManager',
        name:'查询图书',
        component: BookManager
      },
      {
        path : '/AddBook',
        name:'添加图书',
        component: AddBook
      },
    ]

  },
  {
    path : '/BookUpdate',
    component: BookUpdate,
    show:false
  }



];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
